﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;

namespace ProjectDeal.Constraint
{
    public class NotInConstraint : IRouteConstraint
    {
        private List<string> _listString;


        public NotInConstraint(List<string> listString)
        {
            _listString = listString;
        }

        public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
        {

            if (values[parameterName] == null) return false;
            return !_listString.Contains(values[parameterName].ToString());

        }
    }
}